#pragma once

#include "fxcc/core/graph/common/pch.h"

struct SDFChar
{
    glm::vec2 m_Size;
    glm::vec2 m_Bearing;
    glm::vec2 m_Advance;
    int m_Charcode;
    unsigned long m_WChar;
    glm::ivec2 m_TexGridIndex{ 0,0 };
    glm::ivec2 m_TexGridNum{ 1,1 };
    int m_PageIndex{ 0 };
    int m_RealIndex{ 0 };

    void Log() const
    {
        ztclog::info("size %d %d bearing %d %d advance %d %d", m_Size.x, m_Size.y, m_Bearing.x, m_Bearing.y, m_Advance.x, m_Advance.y);
    }
};

struct SDFCharMap
{
    std::map<unsigned long, SDFChar> m_SDFChars;

    bool HasChar(const unsigned long ch) const
    {
        auto it = m_SDFChars.find(ch);
        return m_SDFChars.end() != it;
    }
    const SDFChar& Get(const unsigned long ch) const
    {
        if (HasChar(ch))
        {
            auto it = m_SDFChars.find(ch);
            return it->second;
        }
        auto it = m_SDFChars.find(0);
        return it->second;
    }
    int Size() const
    {
        return m_SDFChars.size();
    }
};

